// ie polyfill
import '@babel/polyfill'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/'
// eslint-disable-next-line space-before-function-paren
// import { VueAxios } from './utils/request'
import AxiosPlugin from '@/utils/plugin/axios-plugin'
import Print from 'vue-print-nb'
import bootstrap from './core/bootstrap'
import './core/use'
import './permission' // permission control
import './utils/filter' // global filter
import operatorPlugin from './utils/plugin/operator-plugin'
import * as echarts from 'echarts'
import moment from 'moment'
import format from 'vue-text-format'

// console.log = function () {}

moment.prototype.toJSON = function () {
  return moment(this).format('YYYY-MM-DD HH:mm:ss')
}
// 获取设置表格高度
Vue.prototype.getTableHeight = function (isPaging) {
  const bodyHeight = document.body.offsetHeight // 网页可见区域高 (包括边线的高)
  const tableBodyTop = document.getElementsByClassName('ant-table-body')[0].getBoundingClientRect().top // tableBody距离顶部距离
  let paginationHeight = 0 // 分页器高度(包括间距);
  if (isPaging) {
    paginationHeight = 32 + 24.5 * 2
  }
  const tabContentBottomPadding = 24 // tab子元素区域下padding
  const contentBottomPadding = 24 // content区域的底部padding
  return bodyHeight - tableBodyTop - paginationHeight - contentBottomPadding - tabContentBottomPadding
}
// moment格式化时间格式
Vue.prototype.timeFormat = function (time, format) {
  return moment(time).format(format)
}

Vue.prototype.$echarts = echarts
Vue.config.productionTip = false
// mount axios Vue.$http and this.$http
// Vue.use(VueAxios)
Vue.use(AxiosPlugin)
Vue.use(operatorPlugin)
Vue.use(Print)
Vue.use(format)
new Vue({
  router,
  store,
  created: bootstrap,
  render: h => h(App)
}).$mount('#app')
